package com.nmgsr.nettools.net.retrofit;



import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public abstract class HttpResponseObserver<T> implements Observer<T> {

    @Override
    public void onSubscribe(Disposable d) {}

    @Override
    public void onNext(T t) {
        onSuccess(t);
    }

    @Override
    public void onError(Throwable e) {
        handleError(e);
    }

    @Override
    public void onComplete() {}

    protected abstract void onSuccess(T response);

    protected abstract void handleError(Throwable e);
}
